//
//  YDYLiveCollectionViewCell.m
//  DY_Bilibili
//
//  Created by 杨德勇 on 2016/10/9.
//  Copyright © 2016年 杨德勇. All rights reserved.
//

#import "YDYLiveCollectionViewCell.h"
#import <YYKit.h>
#import "YDYLive.h"
#import "YDYOwner.h"
#import "YDYCover.h"
#import <UIImageView+WebCache.h>
@interface YDYLiveCollectionViewCell()
//直播封面
@property (weak, nonatomic) IBOutlet UIImageView *coverImageV;
//直播类型
@property (weak, nonatomic) IBOutlet UILabel *liveTypeL;
//直播主名字
@property (weak, nonatomic) IBOutlet UILabel *nameL;
//观看者人数
@property (weak, nonatomic) IBOutlet UITextField *vistorTF;
//描述
@property (weak, nonatomic) IBOutlet UILabel *detailL;

@end

@implementation YDYLiveCollectionViewCell


#pragma mark -
#pragma mark -数据源的setter
-(void)setLive:(YDYLive *)live{
    _live = live;
    self.liveTypeL.text = [NSString stringWithFormat:@"#%@#",live.area];
    self.nameL.text = live.owner.name;
    self.vistorTF.text = [NSString stringWithFormat:@"%ld ",live.online];
    [self.vistorTF setTextAlignment:NSTextAlignmentCenter];
    self.detailL.text = live.title;
    
    [self.coverImageV sd_setImageWithURL:[NSURL URLWithString:live.cover.src] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
        self.coverImageV.image = [self.coverImageV.image imageByRoundCornerRadius:16.0];
    }];
//    [self layoutIfNeeded];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.coverImageV.image = [self.coverImageV.image imageByRoundCornerRadius:16.0];
    
}


@end
